function makeButtons() {
	/*
	$('.btn').each(function(){
   		var b = $(this);
   		var tt = b.text() || b.val();
   		if ($(':submit,:button',this)) {
   			b = $('<a>').insertAfter(this). addClass(this.className).attr('id',this.id);
   			$(this).remove();
   		}
   		b.text('').css({cursor:'pointer'}). prepend('<i></i>').append($('<span>').
  		text(tt).append('<i></i><span></span>'));
  	});
  	*/
}

function submitForm(){
	$(".wideInput").each(function(){
		var edited = $(this).attr('edited');
		var val = jQuery.trim($(this).val());
		var sampleMsg = $(this).attr('sampleMsg');
		if(edited == '0' && val == sampleMsg){
			$(this).val('');
		}
	});
	$('form').submit();
}

/**if input is empty it gets default helper value from 'sampleMsg' tag value*/
function initForm(){
	$(".wideInput").each(function(){
		//error 
		if( $(this).attr('error')!='' ){
			setError(this);
		}
		//sample msg
		if( jQuery.trim( $(this).val() ) == '' ){
			setSampleMsg(this);
		}
		
		//onFocus
		$(this).focus(function(){
			var obj = this;
			if( $(obj).attr('edited') == '0' && jQuery.trim( $(this).val() ) == $(obj).attr('sampleMsg') ){
				$(obj).val('');
			}
			setNormal(obj);
		});
		
		//onblur
		$(this).blur(function(){
			var obj = this;
			if(jQuery.trim( $(obj).val() ) == $(obj).attr('sampleMsg')){
				 $(obj).attr('edited','1');
			}
			else if( jQuery.trim($(obj).val()) == '' ){
				setSampleMsg(obj);
			}
			else{
				setNormal(obj);
			}	
		});
	})
}

/**Sets sample msg and css class*/
function setSampleMsg( obj ){
	var msg = $(obj).attr('sampleMsg');
	$(obj).val(msg);
	setSample(obj);
}

/**removes error, normal and adds sample class */
function setSample(obj){
	$(obj).addClass('sampleInput');
	$(obj).removeClass('errorInput');
	$(obj).removeClass('normalInput');
}

function setError(obj){
	$(obj).addClass('errorInput');
	$(obj).removeClass('sampleInput');
	$(obj).removeClass('normalInput');
}

function setNormal(obj){
	$(obj).addClass('normalInput');
	$(obj).removeClass('errorInput');
	$(obj).removeClass('sampleInput');
}
